import request from '@/config/axios'

export interface CouponUserVO {
  id: number
  inviteId: number
  mobile: string
  verifyStatus: byte
  writeOffStatus: byte
  qrcode: string
  registerIp: string
  loginIp: string
  loginDate: Date
  nickname: string
  name: string
  sex: byte
  mark: string
}

export const getAllSite = async () => {
  return await request.get({ url: '/bank/coupon-site/getall' });
}

export const getAllCodeV2 = async () => {
  return await request.get({ url: '/bank/coupon-code-v2/getall' });
}

// 查询优惠券用户列表
export const getCouponUserPage = async (params) => {
  return await request.get({ url: `/bank/coupon-user/page`, params })
}

// 查询优惠券用户详情
export const getCouponUser = async (id: number) => {
  return await request.get({ url: `/bank/coupon-user/get?id=` + id })
}

// 新增优惠券用户
export const createCouponUser = async (data: CouponUserVO) => {
  return await request.post({ url: `/bank/coupon-user/create`, data })
}

// 修改优惠券用户
export const updateCouponUser = async (data: CouponUserVO) => {
  return await request.put({ url: `/bank/coupon-user/update`, data })
}

// 删除优惠券用户
export const deleteCouponUser = async (id: number) => {
  return await request.delete({ url: `/bank/coupon-user/delete?id=` + id })
}

// 导出优惠券用户 Excel
export const exportCouponUser = async (params) => {
  return await request.download({ url: `/bank/coupon-user/export-excel`, params })
}

// 下载用户导入模板
export const importUserTemplate = () => {
  return request.download({ url: '/bank/coupon-user/get-import-template' })
}
